$('#navigation').tree({
	onClick: function(node){
		//alert(node.id);  // alert node text property when clicked
		//
       if(node.id!="1" ){
		  if ($('#tab').tabs('exists', node.text)){    
		        $('#tab').tabs('select', node.text);    
		    } else {  	
		var  urll='';
    	switch(node.id)
    	{
    	case 'search_info':
    		urll='Home/Quality/show_Quality';//质量信息
    	  break;
    	case '2':
    		urll='Home/Data/result2';
    	  break;
    	}
$('#tab').tabs('add',{ 
    title:node.text, 
    iconCls:node.iconCls,  
    fit:true,
    href:urll,
    closable:true  
}); 
	}
       }
		
	}
});
/*遮罩显示*/
function closes(){
	$("#Loading").fadeOut("normal",function(){
		$(this).remove();
	});
}
var pc;
$.parser.onComplete = function(){
	if(pc) clearTimeout(pc);
	pc = setTimeout(closes, 1000);
};

// 显示设置icon窗口
    function showSetIcon(id,idBt){
        //iconDialog在public/public.html中进行了定义
        $('#iconDialog').dialog("open").dialog('setTitle', '&nbsp;&nbsp;选择图标');
        $('#myIcon').html('请选择您需要的图标');
        $('#iconVal').val('');//清空图标值
        $('#aIcon').val(idBt);//存储按钮id
        $('#inputIcon').val(id);//存储图标input id
    }
//设置图标
function setIcona(text){
  $('#iconVal').val(text);

  var icon='<span class="l-btn-icon '+text+'">&nbsp;</span>';
$('#myIcon').html('您选择的图标是：'+icon);
}

function  setIcon(){

    var inputIcon =$('#inputIcon').val();
    var idBt=  $('#aIcon').val();
    $('#'+inputIcon).val($('#iconVal').val());

    $('#'+idBt).linkbutton({    
    iconCls: $('#iconVal').val() 
});  
  $('#iconDialog').dialog('close');  
}


// 时间戳转换
$.extend({
    myTime:{
        CurTime: function(){
            return Date.parse(new Date())/1000;
        },
        DateToUnix: function(string) {
            var f = string.split(' ', 2);
            var d = (f[0] ? f[0] : '').split('-', 3);
            var t = (f[1] ? f[1] : '').split(':', 3);
            return (new Date(
                parseInt(d[0], 10) || null,
                (parseInt(d[1], 10) || 1) - 1,
                parseInt(d[2], 10) || null,
                parseInt(t[0], 10) || null,
                parseInt(t[1], 10) || null,
                parseInt(t[2], 10) || null
                )).getTime() / 1000;
        },
        UnixToDate: function(unixTime, isFull, timeZone) {
            if (typeof (timeZone) == 'number'){
                unixTime = parseInt(unixTime) + parseInt(timeZone) * 60 * 60;
            }
            var time = new Date(unixTime * 1000);
            var ymdhis = "";
            ymdhis += time.getUTCFullYear() + "-";
            ymdhis += (time.getUTCMonth()+1) + "-";
            ymdhis += time.getUTCDate();
            if (isFull === true){
                ymdhis += "" + time.getUTCHours() + ":";
                ymdhis += time.getUTCMinutes() + ":";
                ymdhis += time.getUTCSeconds();
            }
            return ymdhis;
        }
    }
});
